@REM Copyright (c) 2010 - 2023, Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V.
@REM All rights reserved.
@REM
@REM SPDX-License-Identifier: BSD-3-Clause
@REM
@REM Redistribution and use in source and binary forms, with or without
@REM modification, are permitted provided that the following conditions are met:
@REM
@REM 1. Redistributions of source code must retain the above copyright notice, this
@REM    list of conditions and the following disclaimer.
@REM
@REM 2. Redistributions in binary form must reproduce the above copyright notice,
@REM    this list of conditions and the following disclaimer in the documentation
@REM    and/or other materials provided with the distribution.
@REM
@REM 3. Neither the name of the copyright holder nor the names of its
@REM    contributors may be used to endorse or promote products derived from
@REM    this software without specific prior written permission.
@REM
@REM THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
@REM AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@REM IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
@REM DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
@REM FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
@REM DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
@REM SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
@REM CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
@REM OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
@REM OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@REM
@REM We kindly request you to use one or more of the following phrases to refer to
@REM foxBMS in your hardware, software, documentation or advertising materials:
@REM
@REM - "This product uses parts of foxBMS&reg;"
@REM - "This product includes parts of foxBMS&reg;"
@REM - "This product is derived from foxBMS&reg;"

@SETLOCAL EnableExtensions EnableDelayedExpansion

@set AXIVION=TRUE
@set AXIVION_LOCAL_BUILD=TRUE
@set STORE_REQUESTS_CA_BUNDLE=%REQUESTS_CA_BUNDLE%
@set REQUESTS_CA_BUNDLE=%USERPROFILE%\.bauhaus\auto.crt


@FOR /F "tokens=* USEBACKQ" %%F IN (`git branch --show-current`) DO @(
    @SET AXIVION_BRANCH_NAME=%%F
)

@SET projectName=foxbms-2
@SET analysisProjectName = %projectName% + "-" + %AXIVION_BRANCH_NAME% + "-" + %USERNAME%
@ECHO %analysisProjectName%

@SET projectShadowRepo=%USERPROFILE%\.bauhaus\%projectName%
@ECHO Shadow repo is at '%projectShadowRepo%'.
@IF NOT EXIST %projectShadowRepo% (
    @mkdir %projectShadowRepo%
)

@IF %ERRORLEVEL% NEQ 0 (
    @EXIT /b %ERRORLEVEL%
)
@ECHO Dashboard url is: %AXIVION_DASHBOARD_URL%

@call %~dp0start_analysis.bat
@set REQUESTS_CA_BUNDLE=%STORE_REQUESTS_CA_BUNDLE%
